/*    */ package com.zimbra.cs.client.soap;
/*    */ 
/*    */ import com.zimbra.common.auth.ZAuthToken;
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.AccountConstants;
/*    */ import com.zimbra.common.soap.DomUtil;
/*    */ import com.zimbra.cs.client.LmcSession;
/*    */ import org.dom4j.DocumentHelper;
/*    */ import org.dom4j.Element;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class LmcAuthRequest
/*    */   extends LmcSoapRequest
/*    */ {
/*    */   private String mUsername;
/*    */   private String mPassword;
/*    */   
/*    */   public void setUsername(String u)
/*    */   {
/* 38 */     this.mUsername = u;
/*    */   }
/*    */   
/*    */   public void setPassword(String p) {
/* 42 */     this.mPassword = p;
/*    */   }
/*    */   
/*    */   public String getUsername() {
/* 46 */     return this.mUsername;
/*    */   }
/*    */   
/*    */   public String getPassword() {
/* 50 */     return this.mPassword;
/*    */   }
/*    */   
/*    */   protected Element getRequestXML() {
/* 54 */     Element request = DocumentHelper.createElement(AccountConstants.AUTH_REQUEST);
/* 55 */     Element a = DomUtil.add(request, "account", this.mUsername);
/* 56 */     DomUtil.addAttr(a, "by", "name");
/* 57 */     DomUtil.add(request, "password", this.mPassword);
/* 58 */     return request;
/*    */   }
/*    */   
/*    */ 
/*    */   protected LmcSoapResponse parseResponseXML(Element responseXML)
/*    */     throws ServiceException
/*    */   {
/* 65 */     String authToken = DomUtil.getString(responseXML, "authToken");
/* 66 */     ZAuthToken zat = new ZAuthToken(null, authToken, null);
/*    */     
/* 68 */     String sessionId = DomUtil.getString(responseXML, "session", null);
/*    */     
/* 70 */     LmcAuthResponse responseObj = new LmcAuthResponse();
/* 71 */     LmcSession sess = new LmcSession(zat, sessionId);
/* 72 */     responseObj.setSession(sess);
/* 73 */     return responseObj;
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/client/soap/LmcAuthRequest.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */